<?php
require("../../config.php");
require("../common.php");
require("../../curl.php");
require("../../gen/common.php");


require("www.bt5156.com.php");
require("www.7369dy.cc.php");
require("www.gaoqing.tv.php");
require("www.ed2000.com.php");
require("www.piaohua.com.php");
require("www.y80s.com.php");
require("www.yyets.com.php");
require("www.a67.com.php");
require("www.7060.com.php");

require("www.hunantv.com.php");
require("ent.ifeng.com.php");
require("ent.163.com.php");
require("ent.sina.com.cn.php");
require("yule.sohu.com.php");


header('Content-Type:text/html;charset= UTF-8'); 
date_default_timezone_set('PRC');
set_time_limit(3600);
$conn=mysql_connect ($dbip, $dbuser, $dbpasswd) or die('数据库服务器连接失败：'.mysql_error());
mysql_select_db($dbname, $conn) or die('选择数据库失败');
mysql_query("set names utf8;");

$sitelist=array();
array_push($sitelist,array('http://www.bt5156.com/',1001));
array_push($sitelist,array('http://www.7369dy.cc/',1002));
array_push($sitelist,array('http://www.gaoqing.tv',1003));
array_push($sitelist,array('http://www.ed2000.com/',1004));
array_push($sitelist,array('http://www.piaohua.com',1005));
array_push($sitelist,array('http://www.y80s.com',1006));
array_push($sitelist,array('http://www.yyets.com',1007));
array_push($sitelist,array('http://www.a67.com',1008));
array_push($sitelist,array('http://www.7060.com',1009));

array_push($sitelist,array('http://www.hunantv.com',2001));
array_push($sitelist,array('http://ent.ifeng.com',2002));
array_push($sitelist,array('http://ent.163.com',2003));
array_push($sitelist,array('http://ent.sina.com.cn',2004));
array_push($sitelist,array('http://yule.sohu.com',2005));

//print_r($sitelist);
reader($sitelist);
mysql_close($conn);

class author
{
	var $id;
	var $name;	
	var $clinktype;
	var $ctitle;
	var $updatetime;
	var $rssurl;
	var $rss;
}

function reader($sitelist)
{
	$sql="select * from author where false ";
	foreach($sitelist as $siteurl)
		$sql .=" or (url='$siteurl[0]' and rss=$siteurl[1])";
	$results=dh_mysql_query($sql);
	if($results)
	{
		$author = new author();
		while($row = mysql_fetch_array($results))
		{
			//打开rss地址，并读取，读取失败则中止
			echo $row['name']."的全部文章:</br>\n";
			$author->id=$row['id'];
			$author->name=$row['name'];
			$author->clinktype=$row['clinktype'];
			$author->ctitle=$row['ctitle'];
			$author->updatetime=$row['updatetime'];
			$author->rssurl=$row['rssurl'];
			$author->rss=$row['rss'];
			print_r($author);			
			readrssfile1001($author);
			readrssfile1002($author);
			readrssfile1003($author);
			readrssfile1004($author);
			readrssfile1005($author);
			readrssfile1006($author);
			readrssfile1007($author);
			readrssfile1008($author);
			readrssfile1009($author);
			
			readrssfile2001($author);
			readrssfile2002($author);
			readrssfile2003($author);
			readrssfile2004($author);
			readrssfile2005($author);
        }
	}
}
?>